Skip to content

Preserve legacy timestamp factory construction - #41

Draft
alexstandiford wants to merge 2 commits into
mainfrom
codex/db-timestamp-factory-compat-main
Draft

alexstandiford wants to merge 2 commits into
mainfrom
codex/db-timestamp-factory-compat-main

Conversation

@alexstandiford

@alexstandiford alexstandiford commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Why

DateCreatedFactory and DateModifiedFactory gained a required ClockStrategy constructor in the 3.0 line. Existing Siren and Navigator table definitions construct these factories with no arguments, so the next DB integration fails during table schema construction before database tests can run.

This keeps clock injection available while preserving the established no-argument API. When no clock is supplied, the factory uses the same DateTimeImmutable wall-clock behavior it had before the constructor change.

Scope

  • Make ClockStrategy optional on both timestamp factories.
  • Preserve deterministic injected-clock behavior.
  • Exercise both legacy no-argument and injected-clock paths.

Consumer audit found direct no-argument construction in 28 Siren files, 92 Navigator files, and 8 Courier files. Siren has 23 direct DateModifiedFactory consumers. Updating each table would be a broad migration and would not repair the public factory compatibility contract.

Validation

  • Full DB PHPUnit: 17 tests, 40 assertions, passing.
  • Focused timestamp PHPUnit: 3 tests, 7 assertions, passing.
  • PHPStan level 9 on changed production files: no errors.
  • Siren/Navigator composed validation against DB identity-query commit 00e9a5f independently reproduced the fatal DateCreatedFactory::__construct() requirement before this repair. Those suites could not proceed to their normal assertions because the schema definitions fail during construction.

This PR is intentionally independent of the identity-query PR and is based directly on DB main 43551fc.

CI prerequisites activated here

The repository's inherited gates were not previously honest on current main:

  • The PHPStan workflow ran PHP 8.1 even though the released Composer lock requires PHP 8.2. It now runs PHP 8.2.
  • Spellcheck had 16 exact existing README terms missing from .wordlist.txt. They are now listed without changing README content.
  • PHPStan now has an exact level-9 baseline generated against this PR and released dependencies. It contains 233 pre-existing findings. No production cleanup is included.
  • phpstan.neon includes that baseline at level 9. A deliberate temporary return-type error was detected with exit code 1, proving the baseline does not hide new defects.
  • The PHPUnit workflow is unchanged because build-test already passed on PR41 before these CI-only changes.

Local post-change checks: full PHPUnit 17/40 green, full configured PHPStan level 9 green, deliberate new type error rejected. GitHub build-test, PHPStan, and Spellcheck are green on commit 2f4e78f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant